﻿Public Class ucDotMatrix

    Private c_objDotMatrix As clsDotMatrix


    Public Sub New()

        ' This call is required by the Windows Form Designer.
        InitializeComponent()


        c_objDotMatrix = clsDotMatrix.GetSingleton
        '  AddHandler c_objDotMatrix.DataChanged, AddressOf RefreshDisplay

        AddHandler c_objDotMatrix.ViewChanged, AddressOf RefreshDisplay
    
    End Sub



    Private Sub ucDotMatrixTest_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        c_objDotMatrix.NumLines = 4
        c_objDotMatrix.Refresh()
        'RefreshDisplay()

    End Sub

    Private Sub RefreshDisplay()


        Me.Controls.Clear()
       
        Dim txtDisplayLine As TextBox()
        Dim offsetY As Int32 = 0

        ReDim txtDisplayLine(c_objDotMatrix.DisplayLines.Count)

        For i As Int32 = 0 To c_objDotMatrix.DisplayLines.Count - 1
            txtDisplayLine(i) = New TextBox
            Me.Controls.Add(txtDisplayLine(i))
            offsetY += txtDisplayLine(i).Height + 10
            txtDisplayLine(i).Top = offsetY
            txtDisplayLine(i).MaxLength = 20
            txtDisplayLine(i).Text = c_objDotMatrix.DisplayLines(i)
        Next


    End Sub

End Class
